1. Field of the Invention
The present invention generally relates to a portable storage medium using a flash memory and, more particularly, to a portable storage medium based on universal serial bus (USB) standard and a control method therefore, which can be simply recognized and driven by a host computer through USB and UFI (USB floppy interface), facilitates the extension of the flash memory capacity and ensures high speed of data writing.
2. Description of the Related Art
Conventional portable storage media, which supplement a fixed type storage medium such as a hard disk. Include a floppy disk, CD-ROM and zip drive disk, etc. However, a host computer using this portable storage medium must have an additional drive for the medium. The floppy disk is not widely used because of its small storage capacity. The CD-ROM of large capacity has a weakness that its surface is easily damaged.
Accordingly, a portable storage medium using a flash memory such as a flash drive having large storage capacity has been recently developed and being rapidly popularized. It is easily connected with the host computer and employs USB standard that guarantees high rate of data transmission. The USB standard is a computer port standard proposed by Intel, Microsoft and Compaq in order to develop plug and play. It does not require rebooting of the host computer when a peripheral device is connected to the host computer and ensures fast transmission rate, 12 Mb/s, for example.
Meantime, U.S. Pat. No. 6,148,354 entitled xe2x80x9cArchitecture for a universal serial bus-based PC flash diskxe2x80x9d, U.S. Pat. No. 6,012,103 entitled xe2x80x9cBus interface system and methodxe2x80x9d, and Korea Patent No. 2001-35042 entitled xe2x80x9cPortable storage medium using USB interface and flash memoryxe2x80x9d disclose the configuration of the USB-based portable storage medium and bus interfacing method.
FIG. 1 is a block diagram that roughly illustrates the configuration of the conventional USB-based portable storage medium. Reference numeral 10 represents a host computer having an operating system applying USB standard protocol, and 11 denotes a USB port through which a USB-based peripheral device is physically connected to the host computer. Reference numeral 12 designates a USB host controller for detecting a peripheral device being connected to the USB port 11 and controlling transmission and reception of data between the host computer 10 and the peripheral device based on the USB standard.
Reference numeral 13 denotes an inner storage medium of the host computer 10, such as hard disk, which has the operating system of the host computer 10 and a predetermined client driver. The client driver is provided by a USB flash drive manufacturer, which will be described below. A microprocessor (not shown) of the host computer 10 controls the entire operation of the host computer according to the operating system and the operation routine of the client driver.
The host computer 10 in FIG. 1 may be a computer device having the operating system installed the inner storage medium thereof, such as personal computer, servers and mobile communication terminal. The operating system is a general operating system such as Window 95, 98. ME, XP, MAC OS, including USB standard protocol.
The operating system recognizes the peripheral device connected to the host computer 10 to load a corresponding driver, assigns a USB bus address and system resource to the peripheral device, and operates the USB host controller 12 according to the USB standard. The client driver is loaded by the operating system to prepare a USB flash drive connected to the USB port 11, which will be described below, for operation. In addition, the client driver is compatible with firmware stored in the inner storage medium of the USB flash drive to execute various driving commands for operation of the USB flash drive.
Reference numeral 20 designates the USB flash drive containing a nonvolatile memory that is connected with the USB port 11 of the host computer 10 to store data transmitted from the host computer 10, and write, read and delete data through the host computer 10. Reference numeral 21 denotes a USB connector connected with the USB port 11 of the host computer 10 physically, and 22 represents a memory for storing data sent from the host computer 10, which includes at least one flash memory 221xcx9c22n that is a nonvolatile memory. The flash memory 221xcx9c22n has two kinds of NOR and NAND types. The USB flash drive 20 employs the cheap NAND type flash memory.
In FIG. 1, reference numeral 23 represents a decoder for decoding predetermined memory address information inputted from a processor that will be described below to output a chip select signal for selectively driving the flash memory 221xcx9c22n. Reference numeral denotes a program storage in which a USB flash drive driving program, that is, firmware, is stored, and 25 is the processor for controlling the entire operation of the USB flash drive 20 according to the driving program of the program storage 24.
Hereinafter, the operation of the conventional USB-based portable storage medium constructed as above will be explained.
First of all, when the USB flash drive 20 is connected to the USB port 11 of the host computer 10 to be provided with operation power, the processor 25 in FIG. 1 initializes the flash memory of 221xcx9c22n of the memory 22 according to the operation program of the program storage 24. In addition, the processor 25 transmits predetermined device descriptor information including a manufacturer ID and product ID to the host computer 10 at the host computer""s request for device identification information to inform the host computer of initialization of the operation of the USB flash drive 20. The device descriptor information is basic information based on the USB standard, by which the host computer 10 recognizes the USB flash drive 20.
The host computer 10 receives the device descriptor information through the USB host controller 12, and then inquires peripheral device driver information contained in the operating system to confirm if a driver corresponding to the manufacturer ID and product ID is registered. Here, when the driver of the USB flash drive 20 is confirmed as registered, the host computer 10 loads the client driver according to the operation routine of the operating system and, simultaneously, allocates a USB bus address and system resource to the USB flash drive 20 to prepare its operation.
When it is determined that the driver of the USB flash drive 20 is not registered, on the other hand, the host computer 10 displays a request for installation of the client driver through a monitor (not shown). If a user installs the client driver provided by the manufacturer, the host computer 10 assigns the USB bus address and system resource to the USB flash drive 20 to prepare its operation. Then, the user operates the host computer 10 to store data in the USB flash drive 20, read or delete data from the host computer, or copy data into the host computer 10. At this time, the operating system of the host computer 10 and the operation program of the client driver and USB flash drive 20 work with each other to provide operation routines of data writing/reading/deletion operations of the flash memory 221xcx9c22n. 
With the conventional USB flash drive 20, the client driver of corresponding manufacturer should be installed in the host computer 10 for the initial operation thereof. In case where a user uses a plurality of host computers, the client driver should be installed in each of them in terms of the characteristic of the portable storage medium.
Furthermore, with the NAND flash memory 221xcx9c22n used in the USB flash drive 20, data is read or written in pages of the flash memory when it performs xe2x80x9cwritexe2x80x9d or xe2x80x9creadxe2x80x9d instruction. In addition, before data is written in an arbitrary page, it is required that the entire page of the block including the corresponding page is deleted and then the data is written.
In case where data is written in N pages ranging from block 0 to block 3, represented in black, as shown in FIG. 2, the data is written in the pages of the blocks 1 and 2 after deletion of that blocks because the data can be written on previous data stored therein. In case of the blocks 0 and 3, however, pages P1 required to be preserved exist therein. Accordingly, as shown in FIG. 3, all pages in the original block are copied into a predetermined temporary area block before the deletion of previous data (ST301), and then all of the pages in the original block are deleted (ST302). Subsequently, pages required to be preserved, stored in the temporary area, are restored to a corresponding memory address of the original block (ST303), and data required to be written is written in pages (ST304). This procedure (ST301xcx9cST304) is repeated by the number of pages of the blocks 0 and 3 where the data is written (ST305). Thus, data writing speed becomes considerably slow in case of the conventional NAND type flash memory 221xcx9c22n. 
Moreover, FAT (File Allocation Table) of the flash memory may be damaged due to erroneous operation of the USB flash drive 20 or host computer 10 when the flash memory executes data xe2x80x9cwritexe2x80x9d or xe2x80x9creadxe2x80x9d operation. In this case, the user should reformat the damaged FAT using a cure program (scan disk of Windows, for instance) of the host computer 10 or a predetermined cure program provided by the manufacturer. However, the user cannot appropriately cope with this situation if he is not experienced in handling the program.
Furthermore, in the conventional USB flash drive 20, the decoder 23 outputting the chip select signal to the flash memory 221xcx9c22n is fixed thereto as hardware so that the flash memory cannot be easily added and production cost increases.
An object of the present invention is to provide a portable storage medium based on USB standard and a control method therefor, which can be simply recognized and driven by a host computer through USB and UFI without having an additional client driver, facilitates the extension of the flash memory capacity and ensures high speed of data writing.
To accomplish a first aspect of the present invention, there is provided a portable storage medium, based on USB standard, connected to a USB port of a host computer applying UFI protocol, comprising: a USB connector through which the storage medium is physically connected to the USB port of the host computer; at least one nonvolatile flash memory for storing data transmitted from the host computer; a program storage for storing a predetermined operation program based on USB and UFI; and a controller for controlling the entire operation of the storage medium based on the operation program stored in the program storage, wherein the operation program of the program storage includes a memory processing block for checking and updating header block information of the flash memory, a device recognition processing block for transmitting device descriptor information and interface descriptor information for loading a UFI driver to the host computer, and a UFI processing block for generating predetermined UFI response packets by UFI commands sent from the host computer to transmit them to the host computer.
The flash memory is a NAND type flash memory, and the storage medium includes a USB controller for transmitting and receiving data to and from the host computer based on USB standard, an SMC controller for controlling the operation of the flash memory using an SMC interface signal, and a microprocessor connected to the USB controller and SMC controller to control the operation of the USB controller and SMC controller based on the operation program of the program storage and a UFI command transmitted from the host computer.
The portable storage medium further includes a toggle switch for operating a low-level-formatting operation when FAT information of the flash memory is damaged, wherein the program storage further includes a format processing block for deleting a block 0 of the flash memory when the number of times of switching operations of the toggle switch exceeds a predetermined number of times.
The SMC controller is connected to the flash memory through a data/address bus to transmit data read or written and address information of the data, the program storage includes a memory driving block for selectively driving the flash memory based on memory address information contained in xe2x80x9cwritexe2x80x9d and xe2x80x9creadxe2x80x9d commands transmitted from the host computer, and the microprocessor is connected to the flash memory through a system bus to apply a chip select signal for driving the flash memory according to the operation routine of the memory driving block.
To accomplish a second aspect of the invention, there is provided a method for controlling the recognition of a portable storage medium which is connected to a USB port of a host computer applying UFI protocol and USB standard, the method comprising the steps of: transmitting device descriptor information, containing a manufacturer ID, a product ID and a first class information for selecting a UFI method, to the host computer in response to the request of the device descriptor of the host computer; transmitting interface descriptor information, containing a second class information for selecting UFI protocol, to the host computer in response to the request of the interface descriptor of the host computer; loading a UFI driver of the host computer according to the selected UFI protocol; transmitting a UFI response packet, including predetermined device information and capacity information, to the host computer in response to the request of identifying device and capacity of the host computers; and sending FAT information stored in a flash memory to the host computer in response to the request of FAT information of the host computer.
To accomplish a third aspect of the present invention, there is provided a method for controlling data writing operation of a portable storage medium adapting USB standard, comprising: a first step of confirming if a xe2x80x9cwritexe2x80x9d command is transmitted from a host computer to which the storage medium is connected; a second step of confirming if the transmitted xe2x80x9cwritexe2x80x9d command is the first xe2x80x9cwritexe2x80x9d command; a third step of confirming if the memory address of the current xe2x80x9cwritexe2x80x9d command follows the memory address of the previous xe2x80x9cwritexe2x80x9d command, when the transmitted xe2x80x9cwritexe2x80x9d command is not the first xe2x80x9cwritexe2x80x9d command; and a fourth step of writing a new page, after the previous page, when the memory address of the previous xe2x80x9cwritexe2x80x9d command follows the memory address of the current xe2x80x9cwritexe2x80x9d command, the first to fourth steps being performed in a memory block where pages into which data will be written and pages into which data was written exist concurrently.